package com.example.chatgpt.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import com.example.chatgpt.entity.UserInfo;

import java.util.List;

@Dao
public interface UserDao {
    @Insert
    void insertUser(UserInfo... userInfos);

    //根据用户名查询
    @Query("SELECT * FROM user WHERE user = :user")
    List<UserInfo> queryByUser(String user);

    //修改用户密码
    @Query("UPDATE user SET password =:password WHERE user =:user")
    void updatePass(String user, String password);

    //注销账户
    @Query("DELETE FROM user WHERE user = :user")
    void deleteByUser(String user);
}
